package com.ruoyi.repair.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.repair.domain.StatisticsResult;
import com.ruoyi.repair.service.IStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("/statistics")
public class StatisticsController {

    @Autowired
    private IStatisticsService statisticsService;

    /**
     * 获取基本统计量数据
     */
    @GetMapping("/basic")
    public AjaxResult getBasicStatistics(
            @RequestParam(required = false) String equipmentNo,
            @RequestParam(required = false) Date startDate,
            @RequestParam(required = false) Date endDate) {
        
        Map<String, StatisticsResult> statistics = statisticsService.getBasicStatistics(equipmentNo, startDate, endDate);
        return AjaxResult.success(statistics);
    }
} 